﻿<Window x:Class="LFSRecord2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:vm="clr-namespace:LFSRecord2.ViewModel"
        xmlns:vw="clr-namespace:LFSRecord2.View"
        Title="{Binding WindowTitle}" 
        Width="1024" Height="740"
        WindowStartupLocation="CenterScreen"
        Background="#FF787878" KeyDown="Window_KeyDown" 
        Icon="/LFSRecord2;component/LFS_Cam.ico">
    <Window.Resources>
        <DataTemplate DataType="{x:Type vm:ViewportViewModel}">
            <vw:ViewportView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:TimelineViewModel}">
            <vw:TimelineView />
        </DataTemplate>
        <DataTemplate DataType="{x:Type vm:MediaViewModel}">
            <vw:MediaView />
        </DataTemplate>
    </Window.Resources>
    <DockPanel>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="22" />
                <RowDefinition Height="*" />
                <RowDefinition Height="4" />
                <RowDefinition Height="225" MinHeight="100" />
            </Grid.RowDefinitions>

            <Menu Grid.Row="0" DockPanel.Dock="Top">
                <MenuItem Header="_File">
                    <MenuItem Header="_New" Command="{Binding NewCommand}" InputGestureText="Ctrl+N" />
                    <MenuItem Header="_Open" Command="{Binding LoadCommand}" InputGestureText="Ctrl+O" />
                    <MenuItem Header="Open _Recent" ItemsSource="{Binding RecentProjects, IsAsync=True}">
                        <MenuItem.ItemContainerStyle>
                            <Style TargetType="{x:Type MenuItem}">
                                <Setter Property="Command" Value="{Binding OpenFileCommand, Mode=OneTime}" />
                            </Style>
                        </MenuItem.ItemContainerStyle>
                        <MenuItem.ItemTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Name}" />
                            </DataTemplate>
                        </MenuItem.ItemTemplate>
                    </MenuItem>
                    <MenuItem Header="_Save" Command="{Binding SaveCommand}" InputGestureText="Ctrl+S" />
                    <MenuItem Header="Save _As" Command="{Binding SaveAsCommand}" />
                    <Separator />
                    <MenuItem Header="I_mport">
                        <MenuItem Header="_Import Media File" Command="{Binding ImportMediaCommand}" />
                        <MenuItem Header="_Replay Data From LFS" Command="{Binding ImportReplayDataFromLFSCommand}" />
                    </MenuItem>
                    <MenuItem Header="E_xport">
                        <MenuItem Header="LFS_Record Custom Path" Command="{Binding ExportCustomPathCommand}" />
                        <MenuItem Header="A_fter Effects Comp" Command="{Binding ExportAEPathCommand}" />
                        <MenuItem Header="3_D Studio Path" IsEnabled="False" />
                    </MenuItem>
                    <Separator />
                    <MenuItem Header="_Exit" Command="{Binding ExitCommand}" InputGestureText="Alt+F4" />
                </MenuItem>
                <MenuItem Header="_Edit">
                    <MenuItem Header="_Undo" Command="{Binding UndoCommand}" InputGestureText="Ctrl+Z" />
                    <MenuItem Header="_Redo" Command="{Binding RedoCommand}" InputGestureText="Ctrl+Y" />
                    <Separator />
                    <MenuItem Header="Cu_t" Command="{Binding CutCommand}" InputGestureText="Ctrl+X" />
                    <MenuItem Header="_Copy" Command="{Binding CopyCommand}" InputGestureText="Ctrl+C" />
                    <MenuItem Header="_Paste" Command="{Binding PasteCommand}" InputGestureText="Ctrl+V" />
                </MenuItem>
                <MenuItem Header="_View">
                    <MenuItem Header="_Load track" Command="{Binding LoadTrackCommand}" />
                </MenuItem>
                <MenuItem Header="_Project">
                    <MenuItem Header="_Project Settings" Command="{Binding ProjectSettingsCommand}" />
                    <Separator />
                    <MenuItem Header="_Connect InSim" Command="{Binding InSimConnectCommand}" CommandParameter="1" />
                    <MenuItem Header="_Disconnect InSim" Command="{Binding InSimConnectCommand}" CommandParameter="0" />
                </MenuItem>
                <MenuItem Header="_Layers">
                    <MenuItem Header="_Add">
                        <MenuItem Header="_Look Camera" Command="{Binding AddCameraLayerCommand}" CommandParameter="Look" />
                        <MenuItem Header="_Free Camera" Command="{Binding AddCameraLayerCommand}" CommandParameter="Free" />
                        <MenuItem Header="_Null" Command="{Binding AddNullLayerCommand}" />
                        <MenuItem Header="_Replay Control" Command="{Binding AddReplayControlLayerCommand}" />
                        <MenuItem Header="Replay _Data" Command="{Binding AddReplayDataLayerCommand}" />
                        <MenuItem Header="_Audio Track" Command="{Binding AddAudioLayerCommand}" />
                    </MenuItem>
                    <MenuItem Header="_Delete Selected" Command="{Binding DeleteSelectedLayersCommand}" />
                </MenuItem>
                <MenuItem Header="_Timeline">
                    <MenuItem Header="_Pace Selected Keys" Command="{Binding PaceSelectedKeysCommand}" />
                    <Separator />
                    <MenuItem Header="_Start / Stop Playback" Command="{Binding StartStopCommand}" InputGestureText="Space/Enter" />
                    <MenuItem Header="Stop / _To Start" Command="{Binding StopToStartCommand}" InputGestureText="Num 0" />
                    <MenuItem Header="Start _Recording" Command="{Binding StartRecordCommand}" InputGestureText="*" />
                </MenuItem>
                <MenuItem Header="_Help">
                    <MenuItem Header="About" Command="{Binding AboutCommand}" />
                </MenuItem>
            </Menu>

            <GridSplitter HorizontalAlignment="Stretch" 
                          VerticalAlignment="Top" 
                          Grid.ColumnSpan="3" Grid.Row="2" ResizeBehavior="PreviousAndNext"
                          Height="4" Background="#FF373737" Focusable="False" />

            <Grid Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="250" MinWidth="200" />
                    <ColumnDefinition Width="4" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <GridSplitter HorizontalAlignment="Right" 
                          VerticalAlignment="Stretch" 
                          Grid.Column="1" Grid.Row="1" ResizeBehavior="PreviousAndNext"
                          Width="4" Background="#FF373737" Focusable="False" />

                <ItemsControl Grid.Column="0" ItemsSource="{Binding MediaViewModels}" Focusable="True" />
                <ItemsControl Grid.Column="2" ItemsSource="{Binding ViewportViewModels}" Focusable="True" />
            </Grid>

            <Grid Grid.Row="3">
                <ItemsControl Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding TimelineViewModels}" Focusable="True" />
            </Grid>
            <Label Content="{Binding ConnectionInfo}" Margin="0,-3,0,0" Height="27" HorizontalAlignment="Right" MouseDown="ConnectionInfo_MouseDown" />
        </Grid>
    </DockPanel>
</Window>
